def analysis_rate():
    flow_rate_change = {}
    flow_rate_change_time = {}
    with open('record_rate.txt', 'r',encoding='utf-8') as f:
        for line in f.readlines():
            line=line.rstrip("\n")
            strlist = line.split('-')
            if (strlist[0], strlist[1]) not in flow_rate_change:
                flow_rate_change[(strlist[0], strlist[1])] = []
                flow_rate_change_time[(strlist[0], strlist[1])] = []
            flow_rate_change[(strlist[0], strlist[1])].append(float(strlist[2]))
            flow_rate_change_time[(strlist[0], strlist[1])].append(float(strlist[3]))
    return flow_rate_change,flow_rate_change_time

def check_whether_decrease_second_time():
    flow_rate_change,flow_rate_change_time = analysis_rate();
    for key,value in flow_rate_change.items():
            statue = 0
            statue_change_time = 0
            for i in range(len(value)-1):
                current_statue = 0
                if value[i+1] > value[i]:
                    current_statue = 1
                if(current_statue != statue):
                    statue = current_statue
                    statue_change_time = statue_change_time + 1
            if(statue_change_time>=1):
                print(str(int(key[0])+1) +'-' + str(int(key[1])+1))
                print("z3=",end='')
                print(value)
                print("t=",end='')
                print(flow_rate_change_time[key])
    print("finish")


check_whether_decrease_second_time()
